package com.zg.scf.web;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zg.common.core.R;
import com.zg.scf.domain.req.plan.RailwayPlanAddReq;
import com.zg.scf.domain.req.plan.RailwayPlanEditReq;
import com.zg.scf.domain.req.plan.RailwayPlanPageReq;
import com.zg.scf.domain.vo.RailwayPlanVo;
import com.zg.scf.service.RailwayPlanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * <p>Description: </p>
 *
 * @author zhanfeng.liang
 * @since 2025/5/22 10:54
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/scf/plan")
@Slf4j
@Api(tags = "铁路计划")
public class RailwayPlanController {
    private final RailwayPlanService scfPlanService;


    @PostMapping("/page")
    @ApiOperation(value = "分页")
    public R<Page<RailwayPlanVo>> page(@RequestBody RailwayPlanPageReq pageReq) {
        Page<RailwayPlanVo> page = scfPlanService.page(pageReq, RailwayPlanVo.class);
        return R.success(page);
    }

    @PostMapping("/add")
    @ApiOperation(value = "新增")
    public R add(@RequestBody @Valid RailwayPlanAddReq addReq) {
        scfPlanService.add(addReq);
        return R.success();
    }

    @PostMapping("/edit")
    @ApiOperation(value = "修改")
    public R edit(@RequestBody @Valid RailwayPlanEditReq editReq) {
        scfPlanService.edit(editReq);
        return R.success();
    }

    @PostMapping("/remove")
    @ApiOperation(value = "删除")
    public R remove(@RequestBody  List<Long> ids) {
        scfPlanService.remove(ids);
        return R.success();
    }

    @PostMapping("/sync")
    @ApiOperation(value = "同步")
    public R sync(@RequestBody  List<Long> ids) {
        //TODO
        return R.success();
    }

    @PostMapping("/exportPdf")
    @ApiOperation(value = "导出PDF")
    public R exportPdf(@RequestBody  List<Long> ids) {
        //TODO
        return R.success();
    }
}
